<div class="uk-layui-form">
	<form class="layui-form uk-form" action="/admin/user/save.html">
	  <div class="layui-form-item">
	    <label class="layui-form-label">用户名：</label>
	    <div class="layui-input-inline">
	      <input type="text" name="username" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
	    </div>
	    <div class="layui-form-mid layui-word-aux">用户登录的账号</div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">姓名：</label>
	    <div class="layui-input-inline">
	      <input type="text" name="uname" required lay-verify="required" placeholder="请输入用户姓名" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">电子邮件：</label>
	    <div class="layui-input-inline">
	      <input type="email" name="email"  placeholder="请输入电子邮件地址" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">密码：</label>
	    <div class="layui-input-inline">
	      <input type="password" id="password" name="password" required lay-verify="required|pass" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
	    </div>
	    <div class="layui-form-mid layui-word-aux" style="padding-top:5px !important;">
	    	<input type="password" id="repassword" name="repassword" required lay-verify="repass" placeholder="请再次输入密码" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">手机号：</label>
	    <div class="layui-input-inline">
	      <input type="mobile" name="mobile"  placeholder="请输入手机号码" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">管理员：</label>
	    <div class="layui-input-block">
	      <input type="checkbox" name="admin" lay-skin="switch" lay-filter="admincheckbox" value="1" lay-text="是|否">
	    </div>
	  </div>
	  <#if models?? && models["callcenter"]?? && models["callcenter"] == true>
	  <div class="layui-form-item">
	    <label class="layui-form-label">呼叫中心坐席：</label>
	    <div class="layui-input-inline" style="margin-left:0px;">
	      <input type="checkbox" name="callcenter" lay-skin="switch" value="1" lay-text="开启|关闭">
	    </div>
	    <div class="layui-input-inline">
	      <input type="checkbox" name="bindext" lay-filter="bindext" lay-skin="switch" value="1" lay-text="启用分机绑定|禁用分机绑定">
	    </div>
	  </div>
	  <div class="layui-form-item" id="bindext_tip" style="display:none">
	    <label class="layui-form-label">语音服务器：</label>
	    <div class="layui-input-inline">
	        <select name="hostid" lay-filter="hostid">
	        	<option value="">请选择语音服务器</option>
	        	<#if pbxHostList??>
	        	<#list pbxHostList as pbx>
	        	<option value="${pbx.id!''}" <#if pbxhost?? && pbxhost.id == pbx.id>selected="selected"</#if>>${pbx.name!''}</option>
	        	</#list>
	        	</#if>
	        </select>
	    </div>
	    <div class="layui-form-mid layui-word-aux" id="extno" style="padding-top:5px !important;">
	    		<#include "/admin/user/extno.html">
	    </div>
	  </div>
	  </#if>
	  <div class="layui-form-item"  id="agentDiv">
	    <label class="layui-form-label">多媒体坐席：</label>
	    <div class="layui-input-inline" style="width:100px;">
	      <input type="checkbox" name="agent" lay-skin="switch" value="1" lay-filter="agent" lay-text="开启|关闭">
	    </div>
	    <label class="layui-form-label max_tip" style="width:100px;display:none;padding-left:10px;">最大接入访客：</label>
	    <div class="layui-input-inline max_tip" style="width:150px;display:none;">
	      <select name="maxuser">
	      	<option value="0">默认</option>
	      	<option value="1">1</option>
	      	<option value="2">2</option>
	      	<option value="3">3</option>
	      	<option value="4">4</option>
	      	<option value="5">5</option>
	      	<option value="10">10</option>
	      	<option value="15">15</option>
	      	<option value="20">20</option>
	      	<option value="30">30</option>
	      </select>
	    </div>
	  </div>
	  
	  <div class="layui-form-button">
	    <div class="layui-button-block">
	      <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
	      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    </div>
	  </div>
	</form>
</div>
 
<script>
//Demo
layui.use('form', function(){
  var form = layui.form;
  form.render(); //更新全部
  form.verify({
	  repass: function(value){
	    if(value != $('#password').val()){
	      return '两次输入的密码不一致，请确认';
	    }
	  }
	});  
 	form.on('switch(bindext)', function(data){
		if(data.elem.checked){
			$('#bindext_tip').show();
		}else{
			$('#bindext_tip').hide();
		}
	}); 
 	form.on('switch(agent)', function(data){
		if(data.elem.checked){
			$('.max_tip').show();
		}else{
			$('.max_tip').hide();
		}
	});
 	
 	form.on('select(hostid)', function(data) {
		
		var hostid = data.value;
		
		loadURL("/admin/user/extno?hostid=" + hostid, "#extno");
		
	});
});
</script>